package com.pearl.jacksonspringboot.demo.custom;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.pearl.jacksonspringboot.demo.anno.UserVO;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * @author TD
 * @version 1.0
 * @date 2024/4/12
 */
public class Test {

    public static void main(String[] args) throws JsonProcessingException {
        ObjectMapper objectMapper = new ObjectMapper();

        User user = new User();
        user.setId(1699657986705854464L);
        user.setUsername("zhaolusi");
        List<String> roleList = new ArrayList<>();
        roleList.add("管理员");
        roleList.add("经理");
        user.setRoleList(roleList);

        // 序列化
        String userVoJson = objectMapper.writeValueAsString(user);
        System.out.println(userVoJson);
    }
}
